--
-- 表的结构 `dtask`
--

CREATE TABLE IF NOT EXISTS `dtask` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `last_id` int(11) NOT NULL,
  `uniqid` varchar(100) NOT NULL,
  `request` text NOT NULL,
  `uri` varchar(200) NOT NULL,
  `type` enum('request','response') NOT NULL DEFAULT 'request',
  `response` text  NOT NULL,
  `callback` varchar(200) NOT NULL,
  `callback_data` text NOT NULL,
  `start_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `next_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `end_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `error` text NOT NULL,
  `exec_nums` int(11) NOT NULL,
  `status` enum('new','run','back','close') NOT NULL DEFAULT 'new',
  `back_id` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=4 ;

--
-- 表的结构 `dtask_log`
--

CREATE TABLE IF NOT EXISTS `dtask_log` (
  `id` int(11) NOT NULL,
  `last_id` int(11) NOT NULL,
  `uniqid` varchar(100) NOT NULL,
  `request` text NOT NULL,
  `uri` varchar(200) NOT NULL,
  `type` enum('request','response') NOT NULL DEFAULT 'request',
  `response` text NOT NULL,
  `callback` varchar(200) NOT NULL DEFAULT '',
  `callback_data` text NOT NULL,
  `start_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `next_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `end_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `error` text NOT NULL,
  `exec_nums` int(11) NOT NULL,
  `status` enum('new','run','back','close') NOT NULL DEFAULT 'new',
  `back_id` int(11) NOT NULL DEFAULT '0',
  KEY `uri` (`uri`),
  KEY `uniqid` (`uniqid`),
  KEY `last_id` (`last_id`,`start_time`,`next_time`,`status`),
  KEY `status` (`status`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


--
-- 表的结构 `drequest`
--

CREATE TABLE IF NOT EXISTS `drequest` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `uri` varchar(100) NOT NULL COMMENT 'api地址',
  `request` text NOT NULL COMMENT '请求数据',
  `response` text NOT NULL COMMENT '返回数据',
  `result` text NOT NULL COMMENT '最终结果',
  `key` varchar(100) NOT NULL COMMENT '权限key',
  `add_time` datetime NOT NULL COMMENT '添加时间',
  `update_time` datetime NOT NULL COMMENT '修改时间',
  `nums` int(11) NOT NULL,
  `exec_time` decimal(10,2) NOT NULL COMMENT '执行时长',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COMMENT='访问表' AUTO_INCREMENT=0 ;


--
-- 表的结构 `dlog`
--

CREATE TABLE  `d`.`dlog` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`data` TEXT NOT NULL COMMENT  '日志内容',
`key1` VARCHAR( 20 ) NOT NULL DEFAULT  '' COMMENT  '关键词',
`key2` VARCHAR( 20 ) NOT NULL DEFAULT  '' COMMENT  '关键词',
`level` ENUM(  'sys',  'app',  'debug' ) NOT NULL DEFAULT  'app' COMMENT  'sys:系统日志，app：应用日志，debug：调试日志',
`add_time` DATETIME NOT NULL DEFAULT  '0000-00-00 0000:00:00' COMMENT  '添加时间'
) ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT =  '日志表';

ALTER TABLE  `dlog` ADD INDEX (  `key1` );
ALTER TABLE  `dlog` ADD INDEX (  `key2` );

--
-- 表的结构 `duser`
--

CREATE TABLE IF NOT EXISTS `duser` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `pwd` varchar(32) NOT NULL,
  `app_key` varchar(32) NOT NULL,
  `secret` int(11) NOT NULL,
  `ip` varchar(200) NOT NULL DEFAULT '' COMMENT 'ip地址，比如192.168.0.1/22;192.168.1.1/22',
  PRIMARY KEY (`id`),
  UNIQUE KEY `key` (`app_key`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

--
-- 导出表中的数据 `duser`
--

INSERT INTO `duser` (`id`, `name`, `pwd`, `app_key`, `secret`, `ip`) VALUES
(1, 'api_server', 'c33faeec22f686d8a796968f212adb0d', 'b14edfde2722b03e97cd3b1c5b459223', 0, '127.0.0.1'),
(2, 'tuniuapp', '520tuniuapp', '6c628ed78d4cb06431a934b4237990f9', 0, '127.0.0.1');


CREATE TABLE  `d`.`durl` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT  'ai id',
`nums` INT NOT NULL DEFAULT  '0' COMMENT  '序号',
`uri` VARCHAR( 100 ) NOT NULL DEFAULT  '' COMMENT  '规范uri',
`pattern` VARCHAR( 100 ) NOT NULL DEFAULT  '' COMMENT  '自定义规则',
`params` VARCHAR( 200 ) NOT NULL COMMENT  'url参数',
`is_deleted` TINYINT NOT NULL DEFAULT  '0' COMMENT  '是否启动 -1否',
`add_time` DATETIME NOT NULL DEFAULT  '0000-00-00 00:00:00' COMMENT  '添加时间',
`update_time` DATETIME NOT NULL DEFAULT  '0000-00-00 00:00:00' COMMENT  '修改时间',
`person` INT NOT NULL DEFAULT  '0' COMMENT  '负责人'
) ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT =  '自定义url';
ALTER TABLE  `durl` ADD  `note` VARCHAR( 500 ) NOT NULL DEFAULT  '' COMMENT  '规则描述，请详细描述规则的应用背景，500字' AFTER  `pattern`

CREATE TABLE  `d`.`dplugin` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT  'ai id',
`name` VARCHAR( 100 ) NOT NULL DEFAULT  '' COMMENT  '插件名，只能英文',
`note` VARCHAR( 500 ) NOT NULL DEFAULT  '' COMMENT  '描述，500字',
`init_data` VARCHAR( 500 ) NOT NULL DEFAULT  '' COMMENT  '初始化参数',
`need_start` TINYINT NOT NULL DEFAULT  '0' COMMENT  '默认0不开启，1开启',
`add_time` DATETIME NOT NULL DEFAULT  '0000-00-00 0000:00:00' COMMENT  '添加时间',
`update_time` DATETIME NOT NULL DEFAULT  '0000-00-00 00:00:00' COMMENT  '修改时间',
`person` INT NOT NULL DEFAULT  '0' COMMENT  '负责人id',
`type` TINYINT NOT NULL DEFAULT  '0' COMMENT  '类型0自定义，1全局',
UNIQUE (
`name`
)
) ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_general_ci COMMENT =  '插件管理';





















































